#pragma once

#include "mutex.hpp"

namespace CondModule
{
    class Cond
    {
    public:
        Cond()
        {
            pthread_cond_init(&_cond, nullptr);
        }
        ~Cond()
        {
            pthread_cond_destroy(&_cond);
        }
        void wait(LockModule::Mutex & mutex)
        {
            pthread_cond_wait(&_cond,mutex.GetMutexOriginal());
        }
        void notify()
        {
            pthread_cond_signal(&_cond);
        }
        void notifyall()
        {
            pthread_cond_broadcast(&_cond);
        }
    private:
        pthread_cond_t _cond;
    };
}